package com.bsj.power.common.def.entity.job;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bsj.power.common.constant.NumericalConstants;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * @author LiJiaXin
 * @version 1.0.0
 * @description WorkPersonnel
 * @time 2024/7/17 15:35
 */
@Data
@TableName(value = "tab_work_personnel")
@NoArgsConstructor
public class WorkPersonnel {

    /**
     * 作业人员id
     */
    @TableId(value = "work_personnel_id", type = IdType.AUTO)
    private Integer workPersonnelId;

    /**
     * 姓名
     */
    @TableField("name")
    private String name;

    /**
     * 性别 1男 2女 3未知
     */
    @TableField("gender")
    private Integer gender;

    /**
     * 年龄
     */
    @TableField("age")
    private Integer age;

//    /**
//     * 出生日期
//     */
//    @TableField("date_of_birth")
//    private String dateOfBirth;

    /**
     * 身份证号码
     */
    @TableField("id_card_no")
    private String idCardNo;

    /**
     * 联系方式
     */
    @TableField("phone")
    private String phone;

    /**
     * 临时工号（后台自动生成，保证全局唯一,不仅需要避免本表重复，还需避免与负责人员表的工号重复）
     */
    @TableField("temporary_emp_no")
    private String temporaryEmpNo;

    /**
     * 创建时间
     */
    @TableField("create_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField("update_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 人员组id
     */
    @TableField("group_id")
    private Integer groupId;

    /**
     * 分组名
     */
    @TableField(exist = false)
    private String groupName;

    /**
     * 是否为关注人员 1是 2否
     */
    @TableField("is_attention")
    private Integer isAttention;

    /**
     * 人脸识别事件推送过来的人员id
     */
    @TableField("ext_event_person_no")
    private String extEventPersonNo;

//    /**
//     * 标签设备号（在平台已手动绑卡仍然被扫脸弹出的设备的设备号）
//     */
//    @TableField(exist = false)
//    private String deviceName;

    public WorkPersonnel(String name, String phone, String idCardNo, String extEventPersonNo) {
        this.name = name;
        this.phone = phone;
        this.idCardNo = idCardNo;
        //默认未知
        this.gender = NumericalConstants.THREE;
        this.extEventPersonNo = extEventPersonNo;
    }

    public WorkPersonnel(Integer workPersonnelId, String extEventPersonNo) {
        this.workPersonnelId = workPersonnelId;
        this.extEventPersonNo = extEventPersonNo;
    }

    public WorkPersonnel(String extEventPersonNo, String name, String temporaryEmpNo) {
        this.extEventPersonNo = extEventPersonNo;
        this.name = name;
        this.temporaryEmpNo = temporaryEmpNo;
    }
}
